<div class="mdui-card-header">
    <form id="queryForm">
        <div class="mdui-row">
            <input class="mdui-textfield-input mdui-col-xs-12 mdui-col-sm-3" type="text" placeholder="姓名" name="name" value="${query.name!}">
            <input class="mdui-textfield-input mdui-col-xs-12 mdui-col-sm-3 mdui-col-offset-sm-1" type="text" placeholder="手机号" name="mobile"  value="${query.mobile!}">
            <button type="button" id="queryBtn" onclick="query()" class="ml10 mdui-btn mdui-btn-raised mdui-btn-dense mdui-btn-icon" title="搜索"><i class="mdui-icon material-icons">&#xe8b6;</i></button>
            <button type="button" id="addBtn" class="ml10 mdui-btn mdui-btn-raised mdui-btn-dense mdui-btn-icon" title="添加" onclick="add()"><i class="mdui-icon material-icons">add</i></button>
        </div>
    </form>
</div>

<div class="mdui-card-content">
    <#if dataList?? && (dataList?size > 0)>
        <div class="mdui-table-fluid">
            <table class="mdui-table">
                <thead>
                <tr>
                    <th>姓名</th>
                    <th>身份证号</th>
                    <th>手机号</th>
                    <th>学院</th>
                    <th>车牌号</th>
                    <th>温度状态</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <#list dataList as obj>
                    <tr>
                        <td>${obj.name!}</td>
                        <td>${obj.code!}</td>
                        <td>${obj.mobile!}</td>
                        <td>${obj.academy!}</td>
                        <td>${obj.license!}</td>
                        <#if obj.temperatureStatus == 1>
                            <td><span style="color: green">正常</span></td>
                        <#else>
                            <td><span style="color: red">异常</span></td>
                        </#if>
                        <td>
                            <button onclick="edit('${obj.id!}')" type="button" class="mdui-btn mdui-btn-raised mdui-btn-dense mdui-btn-icon" title="编辑"><i class="mdui-icon material-icons">&#xe3c9;</i></button>
                            <button onclick="del('${obj.id!}','${obj.name!}')" type="button" class="ml10 mdui-btn mdui-btn-raised mdui-btn-dense mdui-btn-icon" title="删除"><i class="mdui-icon material-icons">&#xe872;</i></button>
                            <#if obj.temperatureStatus == 0>
                                <button onclick="resetDo('${obj.id!}','${obj.name!}')" type="button" class="ml10 mdui-btn mdui-btn-raised mdui-btn-dense mdui-btn-icon" title="重置温度状态"><i class="mdui-icon material-icons">&#xe86c;</i></button>
                            </#if>
                        </td>
                    </tr>
                </#list>
                </tbody>
            </table>
        </div>
    <#else>
        <b>暂无信息</b>
    </#if>
</div>

<script>
    function query() {
        loadPost("teacher/index", $("#queryForm").serialize(), "#myContent", true);
    }
    function edit(id) {
        loadPost("teacher/editIndex", 'id=' +id, "#myContent", true);
    }

    function add() {
        loadPost("teacher/addIndex", '', "#myContent", true);
    }

    function resetDo(id,name) {
        mdui.confirm('是否要将老师：'+ name +'的温度状态设置为正常？',
            function(){
                loadPost("teacher/resetDo", 'id=' + id, "#myContent", false);
            },
            function(){

            }
        );
    }
    
    function del(id,name) {
        mdui.confirm('是否删除'+ name,
            function(){
                loadPost("teacher/del", 'id=' + id, "#myContent", false);
            },
            function(){

            }
        );
    }
</script>
